<?php
/**
 * Created by yaoyu.
 * User: Administrator
 * Date: 2020/4/1
 * Time: 13:33
 */

namespace App\Http\Controllers;


use App\Model\News;

class NewsController extends Controller
{
    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index()
    {
        $news = News::orderby('id', 'desc')->paginate(3);
        return view('news.index',compact('news'));
    }

    /**
     * 详情
     * @param $id
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function show($id)
    {
        $news = News::findOrFail($id);
        return view('news.show',compact('news'));
    }
}